﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_BBS_GetAttachmentByID]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_BBS_GetAttachmentByID];
GO
CREATE PROCEDURE [dbo].[sproc_BBS_GetAttachmentByID]
@id int
AS
    IF(@id=0)
    BEGIN
        SELECT * FROM UDS_BBS_Attachment 
    END
    ELSE
        SELECT * FROM UDS_BBS_Attachment WHERE ID=@id